package com.qfmy.web.exception;

import com.qfmy.web.enmu.ResultCode;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

/**
 * @author: 廖志伟
 * @date: 2024-11-28
 * @description: 自定义异常
 */
@Data
@SuppressWarnings("all")
public class BaseException extends RuntimeException {
    //状态码
    private Integer code;
    //错误信息
    private String msg;

    //构造方法
    public BaseException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BaseException(@NotNull ResultCode resultCode) {
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
        this.msg = resultCode.getMessage();
    }
}
